package com.googlecode.c4e.ui.actions.internal;

import org.eclipse.ui.IActionFilter;

import com.googlecode.c4e.api.model.Project;

public class ProjectActionFilter implements IActionFilter {

	public boolean testAttribute(Object target, String name, String value) {
		if (target != null && target instanceof Project && value != null) {
			Project project = (Project) target;
			if ("state".equals(name)) {
				// TODO split tokens and document pattern for defining state
				if (value.indexOf(String.valueOf(project.getState())) != -1) {
					return true;
				} else {
					return false;
				}
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
}
